package com.bus.order;

import com.bus.core.events.order.OrderRemoteEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class OrderApplication {

    @Value("${zhan.app.id}")
    String appId;

    @Autowired
    ApplicationEventPublisher applicationEventPublisher;
    public static void main(String[] args){
        SpringApplication.run(OrderApplication.class ,args);
    }

    @RequestMapping(value = "/pub")
    public String publish(String orderNo){
        OrderRemoteEvent event =new OrderRemoteEvent(new Object() ,appId,"123213123");
        applicationEventPublisher.publishEvent(event);
        return null;
    }
}

